<?php echo $this->Session->flash(); ?>
<h1>ESTUDIO DE TITULOS </h1>
<fieldset>
    <?php
    foreach ($predio as $pre) {
        echo "<label> Codigo:" . $pre['Property']['codigo'] . "</label><br>";
        echo "<label> Nombre:" . $pre['Property']['nombre'] . "</label><br>";
        echo "<label> Area negociación:" . $pre['Property']['area_negociacion'] . "</label><br>";
        echo "<label> Area título:" . $pre['Property']['area_titulo'] . "</label><br>";
        echo "<label> Matricula:" . $pre['Property']['matricula'] . "</label><br>";
        echo "<label> Número catastral:" . $pre['Property']['nro_catastral'] . "</label><br>";
        echo "<h1>PROPIETARIOS:" . "</h1><br>";
    }

    foreach ($owners as $ow) {
        echo "<label> Nombre:" . $ow['Owner']['nombres'] . " " . $ow['Owner']['primer_apellido'] . " " . $ow['Owner']['segundo_apellido'] . "</label><br>";
        echo "<label> Documento:" . $ow['Owner']['documento'] . " " . "</label><br>";
    }
    echo $form->create('TitleStudy');
    echo $form->hidden("TitleStudy.property_id");
    echo $form->input('TitleStudy.hipoteca', array('label' => "¿Tiene Hipoteca?", 'type' => 'select', 'options' => array(0 => 'No', 1 => 'Si')));
    echo $form->input('TitleStudy.valor_hipoteca', array('label' => "Valor de la hipoteca"));
    echo $form->input('TitleStudy.area_obs', array('label' => "Observaciones sobre el area", 'class' => 'txtarea'));
    echo $form->input('TitleStudy.linderos', array('label' => "Linderos", 'class' => 'txtarea'));
    ?>
    <table width="700px" style="border: 1px solid">
        <?php foreach ($condiciones as $con):
            ?>
            <tr>
                <td width="30px"><input type="checkbox" style="width: 50px" value="<?php echo $con['Requirement']['id'] ?>" name="elegidos[]"/></td>
                <td width="300px" style="text-align: justify"><label><?php echo $con['Requirement']['texto'] ?></label></td>
                <td width="250px" style="text-align: justify"><textarea name="texto_<?php echo $con['Requirement']['id'] ?>"></textarea></td>
            </tr>
        <?php endforeach; ?>
    </table>
    <?php
    echo $form->input("TitleStudy.calificacion", array('label' => "Calificación", 'type' => 'select', 'options' => array(0 => 'Sin registro', 1 => 'Cumple', 2 => 'No cumple', 3 => 'Subsanable')));
    echo $form->input("TitleStudy.concepto", array('label' => "Concepto", 'class' => 'txtarea'));
    echo $form->input("TitleStudy.recomendaciones", array('label' => "Recomendaciones", 'class' => 'txtarea'));
    echo $form->input('TitleStudy.doc_subsanacion', array('label' => "Documentos solicitados para subsanación", 'class' => 'txtarea'));
    ?>
    <div id="loading" style="display: none;">
        <?php echo $html->image('loading.gif', array('border' => "0", 'align' => 'center')); ?>
    </div>
    <?php
    if ($this->Session->read('estado') == 0)
        echo $ajax->submit('Guardar', array('url' => array('controller' => 'TitleStudies', 'action' => 'add', $this->data['TitleStudy']['property_id']), 'update' => 'content', 'complete' => 'cargar()', 'indicator' => 'loading'));
    echo $form->end();
    ?>
    <br>
    <?php
    echo $ajax->link($html->image('regresar.gif', array('width' => '30', 'heigth' => '30', 'alt' => 'Regresar', 'title' => 'regresar')), array('controller' => 'TitleStudies', 'action' => 'index'), array('escape' => false, 'update' => 'content', 'complete' => 'cargar()'), null, false);
    ?>
    <br>
</fieldset>
